/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.edu.upc.sigu.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Usuario2
 */
@Entity
@Table(name = "aca_carreras_creditos"  , catalog= "sigu")
@NamedQueries({
    @NamedQuery(name = "CarrerasCreditos.findAll", query = "SELECT c FROM CarrerasCreditos c"),
    @NamedQuery(name = "CarrerasCreditos.findByInstitucion", query = "SELECT c FROM CarrerasCreditos c WHERE c.carrerasCreditosPK.institucion = :institucion"),
    @NamedQuery(name = "CarrerasCreditos.findByPeriodo", query = "SELECT c FROM CarrerasCreditos c WHERE c.carrerasCreditosPK.periodo = :periodo"),
    @NamedQuery(name = "CarrerasCreditos.findByCarrera", query = "SELECT c FROM CarrerasCreditos c WHERE c.carrerasCreditosPK.carrera = :carrera"),
    @NamedQuery(name = "CarrerasCreditos.findByNivel", query = "SELECT c FROM CarrerasCreditos c WHERE c.carrerasCreditosPK.nivel = :nivel"),
    @NamedQuery(name = "CarrerasCreditos.findByCreditosMax", query = "SELECT c FROM CarrerasCreditos c WHERE c.creditosMax = :creditosMax"),
    @NamedQuery(name = "CarrerasCreditos.findByCreditosMin", query = "SELECT c FROM CarrerasCreditos c WHERE c.creditosMin = :creditosMin"),
    @NamedQuery(name = "CarrerasCreditos.findByCreacionUsuario", query = "SELECT c FROM CarrerasCreditos c WHERE c.creacionUsuario = :creacionUsuario"),
    @NamedQuery(name = "CarrerasCreditos.findByCreacionEstacion", query = "SELECT c FROM CarrerasCreditos c WHERE c.creacionEstacion = :creacionEstacion"),
    @NamedQuery(name = "CarrerasCreditos.findByCreacionFecha", query = "SELECT c FROM CarrerasCreditos c WHERE c.creacionFecha = :creacionFecha"),
    @NamedQuery(name = "CarrerasCreditos.findByControlUsuario", query = "SELECT c FROM CarrerasCreditos c WHERE c.controlUsuario = :controlUsuario"),
    @NamedQuery(name = "CarrerasCreditos.findByControlEstacion", query = "SELECT c FROM CarrerasCreditos c WHERE c.controlEstacion = :controlEstacion"),
    @NamedQuery(name = "CarrerasCreditos.findByControlFecha", query = "SELECT c FROM CarrerasCreditos c WHERE c.controlFecha = :controlFecha")})
public class CarrerasCreditos implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CarrerasCreditosPK carrerasCreditosPK;
    @Basic(optional = false)
    @Column(name = "creditos_max")
    private int creditosMax;
    @Basic(optional = false)
    @Column(name = "creditos_min")
    private int creditosMin;
    @Column(name = "creacion_usuario")
    private String creacionUsuario;
    @Column(name = "creacion_estacion")
    private String creacionEstacion;
    @Column(name = "creacion_fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date creacionFecha;
    @Column(name = "control_usuario")
    private String controlUsuario;
    @Column(name = "control_estacion")
    private String controlEstacion;
    @Column(name = "control_fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date controlFecha;
    @JoinColumn(name = "estado_registro", referencedColumnName = "estado_registro")
    @ManyToOne
    private EstadoRegistros estadoRegistros;
    @JoinColumns({
        @JoinColumn(name = "institucion", referencedColumnName = "institucion", insertable = false, updatable = false),
        @JoinColumn(name = "periodo", referencedColumnName = "periodo", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Periodos periodos;
    @JoinColumn(name = "carrera", referencedColumnName = "carrera", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Carreras carreras;

    public CarrerasCreditos() {
    }

    public CarrerasCreditos(CarrerasCreditosPK carrerasCreditosPK) {
        this.carrerasCreditosPK = carrerasCreditosPK;
    }

    public CarrerasCreditos(CarrerasCreditosPK carrerasCreditosPK, int creditosMax, int creditosMin) {
        this.carrerasCreditosPK = carrerasCreditosPK;
        this.creditosMax = creditosMax;
        this.creditosMin = creditosMin;
    }

    public CarrerasCreditos(int institucion, String periodo, String carrera, int nivel) {
        this.carrerasCreditosPK = new CarrerasCreditosPK(institucion, periodo, carrera, nivel);
    }

    public CarrerasCreditosPK getCarrerasCreditosPK() {
        return carrerasCreditosPK;
    }

    public void setCarrerasCreditosPK(CarrerasCreditosPK carrerasCreditosPK) {
        this.carrerasCreditosPK = carrerasCreditosPK;
    }

    public int getCreditosMax() {
        return creditosMax;
    }

    public void setCreditosMax(int creditosMax) {
        this.creditosMax = creditosMax;
    }

    public int getCreditosMin() {
        return creditosMin;
    }

    public void setCreditosMin(int creditosMin) {
        this.creditosMin = creditosMin;
    }

    public String getCreacionUsuario() {
        return creacionUsuario;
    }

    public void setCreacionUsuario(String creacionUsuario) {
        this.creacionUsuario = creacionUsuario;
    }

    public String getCreacionEstacion() {
        return creacionEstacion;
    }

    public void setCreacionEstacion(String creacionEstacion) {
        this.creacionEstacion = creacionEstacion;
    }

    public Date getCreacionFecha() {
        return creacionFecha;
    }

    public void setCreacionFecha(Date creacionFecha) {
        this.creacionFecha = creacionFecha;
    }

    public String getControlUsuario() {
        return controlUsuario;
    }

    public void setControlUsuario(String controlUsuario) {
        this.controlUsuario = controlUsuario;
    }

    public String getControlEstacion() {
        return controlEstacion;
    }

    public void setControlEstacion(String controlEstacion) {
        this.controlEstacion = controlEstacion;
    }

    public Date getControlFecha() {
        return controlFecha;
    }

    public void setControlFecha(Date controlFecha) {
        this.controlFecha = controlFecha;
    }

    public EstadoRegistros getEstadoRegistros() {
        return estadoRegistros;
    }

    public void setEstadoRegistros(EstadoRegistros estadoRegistros) {
        this.estadoRegistros = estadoRegistros;
    }

    public Periodos getPeriodos() {
        return periodos;
    }

    public void setPeriodos(Periodos periodos) {
        this.periodos = periodos;
    }

    public Carreras getCarreras() {
        return carreras;
    }

    public void setCarreras(Carreras carreras) {
        this.carreras = carreras;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (carrerasCreditosPK != null ? carrerasCreditosPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CarrerasCreditos)) {
            return false;
        }
        CarrerasCreditos other = (CarrerasCreditos) object;
        if ((this.carrerasCreditosPK == null && other.carrerasCreditosPK != null) || (this.carrerasCreditosPK != null && !this.carrerasCreditosPK.equals(other.carrerasCreditosPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.upc.sigu.entities.CarrerasCreditos[carrerasCreditosPK=" + carrerasCreditosPK + "]";
    }

}
